<template>
  <view class="user-banner">
    <view
      class="d-flex items-center"
      @tap="$tools.to('/pages/customer-center/userinfo/userinfo')"
    >
      <image
        class="user-banner-avatar"
        src="/static/images/base/default_avatar.png"
      />
      <text class="user-banner-name">147******10</text>
    </view>
    <view
      class="user-banner-ruletag"
      :style="ruleTagBgColor"
    >
      等级规则
    </view>
  </view>
</template>

<script>
export default {
  name: "UserBanner",
  props: {
    level: {
      type: Number,
      default: 0
    }
  },
  computed: {
    ruleTagBgColor() {
      let colors = ["#97afff", "#ffd17b", "#d6abff", "#282525"]
      return `background: ${colors[this.level]}`
    }
  },
  methods: {}
}
</script>

<style lang="scss" scoped>
.user-banner {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 0 $uni-spacing-row-xl;
  z-index: 100;

  &-avatar {
    width: 80rpx;
    height: 80rpx;
    margin-right: $uni-spacing-row-xl;
  }

  &-name {
    font-size: $uni-font-size-lg;
    color: #fff;
  }

  &-ruletag {
    padding: $uni-spacing-row-sm $uni-spacing-row-base;
    border-radius: $uni-border-radius-lg 0 0 $uni-border-radius-lg;
    color: #fff;
    font-size: $uni-font-size-sm;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
</style>
